import os
import md5
import datetime
import models

from constants import DATABASE_FILE
from dbutils import *

import sqlalchemy

# Initialize the engine.
Session = models.SessionMaker(DATABASE_FILE)
session = Session()

gabe = CreateUser("Gabriel", "Taubman", "gtaubman", "gtaubman@mac.com", "admin", True)
solon = CreateUser("Solon", "Gordon", "solongordon", "solongordon@gmail.com", "admin", True)
oscar = CreateUser("Oscar", "Zilch", "ozilch", "ozilch@gmail.com", "admin", False)

session.add(gabe)
session.add(solon)
session.add(oscar)
session.commit()

for user in session.query(models.User):
  print "-" * 10
  print user.firstname, user.lastname
  print user.email

print "%d Users." % session.query(models.User).count()
